<?php
/*--------------------------------------------------------------
# eShop.com - January 2009 (for Joomla 1.5)
# Copyright (C) 2009 Gavick.com. All Rights Reserved.
# License: Copyrighted Commercial Software
# Website: http://www.gavick.com
# Support: support@gavick.com 
---------------------------------------------------------------*/
// no direct access
defined('_JEXEC') or die('Restricted access');

include_once(JPATH_ROOT . "/templates/" . $this->template . '/lib/php/gk_setup.php');
$template_baseurl = $this->baseurl . '/templates/' . $this->template;
JHTML::_('behavior.mootools');

$mtype = $this->params->get("menutype", "moomenu");
$advsearch = ($this->params->get("advsearch", 1)  == 0) ? false : true;
$menu = & JSite::getMenu();
$frontpage_i = ($this->params->get("frontpage", 1) == 1) ? false : ($menu->getActive() == $menu->getDefault());
$url = clone(JURI::getInstance());		

$user =& JFactory::getUser(); 
$userID = $user->get('id');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
<head>
<jdoc:include type="head" />
<?php 
    include_once(JPATH_ROOT . "/templates/" . $this->template . '/lib/php/menu.php');
    include_once(JPATH_ROOT . "/templates/" . $this->template . '/lib/php/gk_head.php');
?>
</head>
<body id="bg">
<div id="spot">
      <div id="page1002" class="clearfix">
            <div id="page1002a" class="clearfix">
                  <?php if ($this->countModules('hidden1')) : ?>
                  <div id="hiddenarea1">
                        <h3>Your Shopping Cart <span id="close_button1">&nbsp;</span></h3>
                        <div id="hiddenarea_wrap1">
                              <jdoc:include type="modules" name="hidden1" style="raw" />
                        </div>
                  </div>
                  <?php endif; ?>
                  <?php if ($this->countModules('hidden2')) : ?>
                  <div id="hiddenarea2">
                        <h3>Member Login <span id="close_button2">&nbsp;</span></h3>
                        <div id="hiddenarea_wrap2">
                              <jdoc:include type="modules" name="hidden2" style="raw" />
                        </div>
                  </div>
                  <?php endif; ?>
                  <div id="bg_top">
                        <div id="top">
                              <a href="<?php echo $this->baseurl;?>" class="nounder" id="logo"></a>
                              <?php if ($this->countModules('banner468x60')) : ?>
                              <div id="topbanner">
                                    <jdoc:include type="modules" name="banner468x60" style="raw" />
                              </div>
                              <?php endif; ?>
                              <p id="trblock">
                                    <?php if($this->params->get("show_cart", 1)  == 1) : ?>
                                    <a href="index.php?page=shop.cart&option=com_virtuemart&Itemid=53" id="scart"><?php echo JText::_('YSCART'); ?></a>
                                    <?php endif; ?>
                                    <?php if($this->params->get("show_login", 1)  == 1) : ?>
                                    <a href="" id="login_btn" class="first"><?php echo ($userID == 0) ? JText::_('LOGIN') : JText::_('LOGOUT'); ?></a>
                                    <?php endif; ?>
                                    <?php if($this->params->get("show_register", 1)  == 1) : ?>
                                    <a href="<?php echo JRoute::_( 'index.php?option=com_user&task=register' ); ?>"><?php echo JText::_('REGISTER'); ?></a>
                                    <?php endif; ?>
                              </p>
                        </div>
                  </div>
                  <!--top-->
                  <div class="page970">
                        <div id="horiz-menu" class="nav">
                              <?php echo $main_navigation;?>
                        </div>
                        <?php if($advsearch) : ?>
                        <div id="advanced_search_form">
                              <span class="isearch"><?php echo JText::_("ADV_SEARCH"); ?>:</span>
                              <?php
									$url = & JURI::getInstance();
 									$db = & JFactory::getDBO();
									$query = "SELECT `c`.`category_name` AS `name` , `c`.`category_id` AS `id` FROM `#__vm_category` AS `c` ORDER BY `c`.`category_id`;";
									$db->setQuery($query);
									$categoriesListt = $db->loadObjectList();
								?>
                              <form name="adv_search" method="post" action="<?php echo $url->root(); ?>">
                                    <input type="hidden" value="shop.browse" name="page"/>
                                    <input type="hidden" value="com_virtuemart" name="option"/>
                                    <input type="hidden" value="9999" name="Itemid"/>
                                    <input type="text" size="20" name="keyword1" class="inputbox"/>
                                    <select name="search_op" class="styled_short">
                                          <option value="and"><?php echo JText::_("AND"); ?></option>
                                          <option value="and not"><?php echo JText::_("NOT"); ?></option>
                                    </select>
                                    <input type="text" size="20" name="keyword2" class="inputbox"/>
                                    <select name="search_category" class="styled_long">
                                          <option value="0"><?php echo JText::_("SEARCH_ALL"); ?></option>
                                          <?php foreach($categoriesListt as $row) : ?>
                                          <option value="<?php echo $row->id; ?>"><?php echo $row->name; ?></option>
                                          <?php endforeach; ?>
                                    </select>
                                    <select name="search_limiter" class="styled_long">
                                          <option value="anywhere"><?php echo JText::_("SEARCH_ALL_PR"); ?></option>
                                          <option value="name"><?php echo JText::_("PROD_NAME"); ?></option>
                                          <option value="cp"><?php echo JText::_("MANUFACTURE"); ?></option>
                                          <option value="desc"><?php echo JText::_("DESC"); ?></option>
                                    </select>
                                    <input type="submit" value="<?php echo JText::_("SEARCH"); ?>" name="search" class="button search"/>
                              </form>
                        </div>
                        <?php endif; ?>
                  </div>
                  <div id="restofpage">
                        <?php if ($this->countModules('header')) : ?>
                        <div id="header" class="clearfix">
                              <?php if ($this->countModules('header')) : ?>
                              <div id="hleft">
                                    <jdoc:include type="modules" name="header" style="xhtml" />
                              </div>
                              <?php endif; ?>
                              <!--header-->
                        </div>
                        <?php endif; ?>
                        <div class="clearfix" id="content_wrap<?php echo $content_class ?>">
                              <?php if ($this->countModules('left')) : ?>
                              <div id="left<?php echo $marg; ?>">
                                    <jdoc:include type="modules" name="left" style="gavickpro" headerLevel="3" />
                              </div>
                              <?php endif; ?>
                              <div id="component<?php echo $w_count ?>">
                                    <?php if ($this->countModules('top')) : ?>
                                    <div class="us-stand">
                                          <jdoc:include type="modules" name="top" style="gavickpro" headerLevel="3" />
                                    </div>
                                    <?php endif; ?>
                                    <?php if ($this->countModules('user1') or $this->countModules('user2')) : ?>
                                    <div id="user_position-1" class="<?php echo $user_position_1w; ?>">
                                          <?php if ($this->countModules('user1')) : ?>
                                          <div class="users">
                                                <jdoc:include type="modules" name="user1" style="gavickpro" headerLevel="3" />
                                          </div>
                                          <?php endif; ?>
                                          <?php if ($this->countModules( 'user1 and user2' )) : ?>
                                          <div class="spacer"></div>
                                          <?php endif; ?>
                                          <?php if ($this->countModules('user2')) : ?>
                                          <div class="users">
                                                <jdoc:include type="modules" name="user2" style="gavickpro" headerLevel="3" />
                                          </div>
                                          <?php endif; ?>
                                    </div>
                                    <?php endif; ?>
                                    <?php
    						// show mainbody on all subpages but not on frontpage
							if (!$frontpage_i) :
						?>
                                    <div id="mainbody">
                                          <jdoc:include type="component" />
                                    </div>
                                    <?php endif; ?>
                                    <?php if ($this->countModules('user3') or $this->countModules('user4')) : ?>
                                    <div id="user_position-2" class="<?php echo $user_position_2w; ?>">
                                          <?php if ($this->countModules('user3')) : ?>
                                          <div class="users">
                                                <jdoc:include type="modules" name="user3" style="gavickpro" headerLevel="3" />
                                          </div>
                                          <?php endif; ?>
                                          <?php if ($this->countModules( 'user3 and user4' )) : ?>
                                          <div class="spacer"></div>
                                          <?php endif; ?>
                                          <?php if ($this->countModules('user4')) : ?>
                                          <div class="users">
                                                <jdoc:include type="modules" name="user4" style="gavickpro" headerLevel="3" />
                                          </div>
                                          <?php endif; ?>
                                    </div>
                                    <?php endif; ?>
                                    <?php if ($this->countModules('bottom')) : ?>
                                    <div class="us-stand">
                                          <jdoc:include type="modules" name="bottom" style="gavickpro" headerLevel="3" />
                                    </div>
                                    <?php endif; ?>
                              </div>
                              <?php if ($this->countModules('right')) : ?>
                              <div id="right">
                                    <jdoc:include type="modules" name="right" style="gavickpro" headerLevel="3" />
                              </div>
                              <?php endif; ?>
                        </div>
                        <!--restofpage-->
                  </div>
                  <!--page970-->
                  <?php if($this->countModules('user5 or user6 or user7 or user8 or user9 or user10')) : ?>
                  <div id="user_position-3" class="page970 clearfix <?php echo $user_position_3w; ?>">
                        <div id="user_position_3wrap">
                              <?php if ($this->countModules('user5')) : ?>
                              <div class="users">
                                    <jdoc:include type="modules" name="user5" style="xhtml" />
                              </div>
                              <?php endif; ?>
                              <?php if ($this->countModules('user6')) : ?>
                              <div class="users">
                                    <jdoc:include type="modules" name="user6" style="xhtml" />
                              </div>
                              <?php endif; ?>
                              <?php if ($this->countModules('user7')) : ?>
                              <div class="users">
                                    <jdoc:include type="modules" name="user7" style="xhtml" />
                              </div>
                              <?php endif; ?>
                              <?php if ($this->countModules('user8')) : ?>
                              <div class="users">
                                    <jdoc:include type="modules" name="user8" style="xhtml" />
                              </div>
                              <?php endif; ?>
                              <?php if ($this->countModules('user9')) : ?>
                              <div class="users">
                                    <jdoc:include type="modules" name="user9" style="xhtml" />
                              </div>
                              <?php endif; ?>
                              <?php if ($this->countModules('user10')) : ?>
                              <div class="users">
                                    <jdoc:include type="modules" name="user10" style="xhtml" />
                              </div>
                              <?php endif; ?>
                        </div>
                  </div>
                  <?php endif; ?>
            </div>
      </div>
      <div id="footer_wrap">
            <?php 
				// including footer file
				include_once(JPATH_ROOT . "/templates/" . $this->template . '/lib/php/gk_footer.php'); 
			?>
      </div>
</div>
<?php 
	// including information alert for IE6
	if($this->params->get("ie6info", 1) == 1): 
?>
<!-- IE6 alert -->
<div id="ie6">
      <?php include_once(JPATH_ROOT."/templates/".$this->template.'/lib/php/gk_ie6.php'); ?>
</div>
<?php endif; ?>
<!--page1002-->
<jdoc:include type="modules" name="debug" />
</body>
</html>
